package com.biz;

import com.dao.DiscussMapper;
import com.entity.Discuss;
import com.util.PageBean;
import com.util.QueryDiscuss;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class IDiscussBizImp implements IDiscussBiz{

    @Autowired
    private DiscussMapper dao;

    public DiscussMapper getDao() {
        return dao;
    }

    public void setDao(DiscussMapper dao) {
        this.dao = dao;
    }

    @Override
    public List<Discuss> getAll() {
        return dao.getAll();
    }

    @Override
    public void add_discuss(Discuss dd) {
       dao.add_discuss(dd);
    }

    @Override
    public void del_discuss(int id) {
       dao.del_discuss(id);
    }

    @Override
    public Discuss getById(int id) {
        return dao.getById(id);
    }

    @Override
    public void mod_discuss(Discuss dd) {
        dao.mod_discuss(dd);
    }

    @Override
    public PageBean getPage_discuss(int page, QueryDiscuss qd) {
        PageBean bean=new PageBean();
        bean.setCurrpage(page);
        bean.setPagesize(5);
        bean.setList(dao.get_list(qd, page, bean.getPagesize()));
        bean.setTotalrow(dao.getCount_Discuss(qd));
        return bean;
    }

    @Override
    public List<Map> getByBid(Integer bid) {
        return dao.getByBid(bid);
    }
}
